default_platform(:ios)

update_fastlane

platform :ios do
  desc "Depoy new version"
  lane :release do
    ensure_git_branch
    version = version_get_podspec(path: "Localize-Swift.podspec")
    changelog = prompt(text: "Changelog: ", multi_line_end_keyword: "END")

    github_token = ENV['GITHUB_TOKEN']
    if !github_token || github_token.empty?
      github_token = prompt(text: "Please enter your GitHub token: ")
    end

    github_release = set_github_release(
      repository_name: "marmelroy/Localize-Swift",
      api_token: github_token,
      name: version,
      tag_name: version,
      description: changelog,
      commitish: "master"
    )
    sh("git fetch --tags")
    pod_push(allow_warnings: true, verbose: true)
  end
end
